package com.santiao.publics.base

import android.app.Activity
import android.content.Context
import android.os.Bundle
import android.view.View
import android.widget.ImageButton
import androidx.appcompat.app.AppCompatActivity

import com.santiao.youxiang.R
//import com.santiao.youxiang.R


import java.util.*

open class BaseActivity : AppCompatActivity(), View.OnClickListener {
    lateinit var mContext: Context
    open var mActivity: Activity? = null


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mActivity = this
        mContext = this
    }


    open fun initTitle() {
        var btnBack = findViewById<ImageButton>(R.id.btn_back)
        btnBack?.setOnClickListener(this)
    }

    open fun getStatus(): Int {
        val random = Random()
        var status = -1
        val random_number = random.nextDouble() // 生成0到1之间的随机数
        if (random_number > 0.6) {
            status = 1
        }
        return status
    }

    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.btn_back -> {
                this.finish();
            }
        }
    }

}
